//制作检测用户是否登陆的功能
$.ajax({
    url:"/employee/checkRootLogin",
    async:false,
	success:function(result){
		if(result.success == true){
			location.href = "login.html"
		}
	}
})

$(function(){
    $(".btn-primary").on("click",function(){
        var username =$("input[name='username']").val();
        var password =$("input[name='password']").val();

        if(username.trim() == ""){
            alert("请输入用户名");
        }

        if(password.trim() == ""){
            alert("请输入密码");
        }

        $.ajax({
            url:"/employee/employeeLogin",
            type:"post",
            data:{username:username,password:password},
            success:function(result){
                if(result.success == true){
                    location.href = "user.html";
                }else{
                    alert(result.message);
                }
            }
        })
    })
})